/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.srcptit.trainning.thompv.BaitapMuc1_2;
import java.util.Scanner;
/**
 *
 * @author SONY
 */
public class Bai3Muc1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int i=2,stop=1,n;
        String s;
        System.out.print("Nhap 1 so nguyen: ");
        while(stop==1)
        {
            try
            {
                s=sc.nextLine();
                if(s.length()<1) throw new Exception("");
                n=Integer.parseInt(s);
                if(n<=1) throw new Exception("");
                stop=0;
                System.out.print("Ket qua: ");
                while(n>1)
                {
                    if(n%i==0)
                    {
                        System.out.print("  "+i+"  ");
                        n/=i;
                    }
                    else i++;
                }
            }
            catch (Exception e)
            {
                System.out.println("Moi ban nhap lai");
            }
        }
    }
}
